/*
 * EasyCamera
 *
 * Copyright (c) 2021.  Frezrik frezrik@126.com
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */

package com.camera;

import android.util.Log;

/**
 * @author zhouming 2021/1/4
 */
public class Logger {
    public enum LEVEL {
        DEBUG,
        WARNING,
        ERROR
    }

    private static LEVEL mLevel = LEVEL.ERROR;

    public static void setLogLevel(LEVEL level) {
        mLevel = level;
    }

    public static void d(String tag, String msg) {
        if (mLevel.compareTo(LEVEL.DEBUG) <= 0) {
            Log.d(tag, msg);
        }
    }

    public static void w(String tag, String msg) {
        if (mLevel.compareTo(LEVEL.WARNING) <= 0) {
            Log.w(tag, msg);
        }
    }

    public static void e(String tag, String msg) {
        if (mLevel.compareTo(LEVEL.ERROR) <= 0) {
            Log.e(tag, msg);
        }
    }
}
